package iset.coverageanalyzer.data;

import iset.coverageanalyzer.config.ConfigInfo;

import java.util.ArrayList;


public class CoverageInfo {
	
	
	public ConfigInfo configInfo = null;
	
	public String packageName = null;
	public String className = null;
	public String method = null;
	public int argNum = 0;
	public String args = null;
	public int lineNum = 0;
	
	public int method_startLineNum = 0;
	public int method_endLineNum = 0;
	
	public ArrayList<Boolean> canBeSolved = null;
	
	public CoverageInfo(ConfigInfo configInfo){
		this.configInfo = configInfo;
		canBeSolved = new ArrayList<Boolean>();
	}
	
	public String extractJPFTarget(){
		//return this.packageName+"."+this.className;
		if(this.packageName == null){
			return this.className;
		}else if(this.packageName.equalsIgnoreCase("")){
			return this.className;
		}else{
			return this.packageName+"."+this.className;
		}
	}
	
	public String extractJPFMethod(){
		String symbc_args = "sym";
		if( !canBeSolved.get(0).booleanValue()){
			symbc_args = "con";
		}
		
		for(int i=1;i<argNum;i++){
			if(canBeSolved.get(i).booleanValue()){
				symbc_args += "#sym";
			}else{
				symbc_args += "#con";
			}
		}
		
		if(argNum == 0)
			symbc_args = "";
		
		return this.extractJPFTarget()+"."+this.method+"("+symbc_args+")";
	}
	
	// for testing
	public static void main(String[] args){
		CoverageInfo ci = new CoverageInfo(null);
		ci.argNum = 1;
		ci.packageName = "package";
		ci.className = "class";
		ci.method = "method";
		System.out.println(ci.extractJPFMethod());
	}
	
}
